﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AmorCanino.Web.Models.Services
{
    public class CategoriesService : BaseService, ICategoriesService
    {
        public IEnumerable<Models.Category> GetCategories()
        {
            var db = new AmorCaninoDBDataContext();

            return db.ProductCategories.Where(c => c.Visible && c.ParentCategoryId == 0)
                    .OrderBy(c => c.CategoryDescription)
                    .Select(c => new Models.Category() {
                        Description = c.CategoryDescription,
                        CategoryId = c.CategoryId
                    }).ToList();
        }
    }
}